﻿using Emoney.UserTraining.Cache;
using Emoney.UserTraining.DAL;
using Emoney.UserTraining.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Emoney.UserTraining.BLL
{
    public class Training_MeetingUserBLL
    {
        private readonly Training_MeetingUserDAL dal = new Training_MeetingUserDAL();

        
        public int AddUser(Training_MeetingUser c)
        {
            return dal.AddUser(c);
        }
        public List<Training_MeetingUser> GetLstOrderUser(Training_MeetingUser c)
        {
            return dal.GetLstOrderUser(c);
        }
        public int ModifyUser(int id, string is30tip, DateTime time)
        {
            return dal.ModifyUser(id, is30tip, time);
        }

        public int ModifyUserById(int id, string isOrder)
        {
            return dal.ModifyUserById(id, isOrder);
        }

        public List<TrainNetwoekAndUser> GetLstByUserName(string userName)
        {
            List<TrainNetwoekAndUser> list = new List<TrainNetwoekAndUser>();
            string key = "mytraindetail_" + userName;
            News2CacheTools cache = new News2CacheTools();
            var obj = cache.Get<List<TrainNetwoekAndUser>>(key);
            if (obj != null)
            {
                list = obj;
            }
            else
            {
                list = dal.GetLstByUser(userName);
                cache.Add(key, list, 0, 1, 0);
            }
            return list;
        }

        public List<TrainNetwoekAndUser> GetLstByUid(string uid)
        {
            return dal.GetLstByUid(uid);
        }   
    }
}
